package com.cn.wang.demo;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.UUID;

import org.apache.commons.lang.StringUtils;

public class StrategyContext {
	private String contexts;
	public StrategyContext( StrategyInterDemo strategyInterDemo){
		strategyInterDemo.selectType();
	}
	
	public static void main(String[] args) throws IOException{
		String date = "2016-09-09";
		UUID.randomUUID();
		int a= Integer.valueOf(date.replace("-", ""));
		System.out.println(UUID.randomUUID());
	      System.out.println (StringUtils.defaultString ("aaaa") );  
	        System.out.println ("?" + StringUtils.defaultString (null) + "!");  
//		StrategyContext strategyContext = new StrategyContext(new StrategyTwo());
		File file = new File("D:/wang.txt");
		if(!file.exists())
			try {
				file.createNewFile();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		FileOutputStream outputStream = new FileOutputStream(file);
		BufferedOutputStream bOutputStream = new BufferedOutputStream(outputStream);
		String aa = "wangzaogen11111111111";
//		outputStream.write(aa.getBytes());
//		outputStream.close();
		bOutputStream.write(aa.getBytes());
		bOutputStream.close();
		int n=512;
		byte buffer[] = new byte[n];
		FileInputStream inputStream = new FileInputStream(file);
		BufferedInputStream bInputStream = new BufferedInputStream(inputStream);
		while(bInputStream.read(buffer)!=-1){
			System.out.println(new String(buffer));
		}
		inputStream.close();
	}
}
